/**
 * 2017年5月30日
 */
package cn.edu.bjtu.workbench;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.ServletListenerRegistrationBean;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;

import cn.edu.bjtu.workbench.mvc.ee.StartListener;

/**
 * 启动web接口,供程序进行 调用,进行文本的分类.并且
 * 根据用户对于分类结果的好坏更新模型参数,优化分类器.
 * SpringBoot相关的Controller类放在mvc.controller包里面
 * @author DengLuoDan
 *
 */
@SpringBootApplication
public class AppWeb implements EmbeddedServletContainerCustomizer{
    public static void main(String[] args){
        	SpringApplication.run(AppWeb.class);  
    }
    
	@Bean
	public ServletListenerRegistrationBean<StartListener> get(){
		ServletListenerRegistrationBean<StartListener> b = new ServletListenerRegistrationBean<StartListener>(new StartListener());
		return b;
	}
	@Bean
	EmbeddedServletContainerFactory getBean2(){
		return new TomcatEmbeddedServletContainerFactory();
	}
	@Override
	public void customize(ConfigurableEmbeddedServletContainer container) {
		container.setPort(8082);
	}
}
